package cn.wanho.mapper;

import cn.wanho.dto.ExamPaper;
import cn.wanho.rvo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ExamPaperMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(ExamPaper record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(ExamPaper record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    ExamPaper selectByPrimaryKey(Integer id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(ExamPaper record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(ExamPaper record);

    /**
     * @author jingxu
     * @date 2022-8-5
     * 只是根据试卷id去查询试卷，看试卷是否存在
     */
    ExamPaper takeExamPaper(@Param("id") Integer id);

    /**
     * @author jingxu
     * @date 2022-8-5
     * 根据试卷id查对应选择题
     */
    List<ExamChoose> selectChoose(@Param("paperId")Integer paperId);

    /**
     * @author jingxu
     * @date 2022-8-5
     *根据试卷id来查对应的填空题
     */
    List<ExamSubject> selectBlanks(@Param("paperId")Integer paperId);

    /**
     * @author jingxu
     * @date 2022-8-5
     *根据试卷id来查对应的判断题
     */
    List<ExamSubject> selectTf(@Param("paperId")Integer paperId);


    /**
     * @author jingxu
     * @date 2022-8-5
     *根据试卷id来查对应的简答题题
     */
    List<ExamSubject> selectBig(@Param("paperId")Integer paperId);

    /**
     * @author jingxu
     * @date 2022-8-7
     * 根据试卷id和学生id来查询学生的成绩---选择题
     */
    List<ExamChooseVO> selectExamChoose(@Param("studentId")Integer studentId, @Param("paperId")Integer paperId);

    /**
     * @author jingxu
     * @date 2022-8-7
     * 填空题
     */
    List<ExamSubjectVO> selectExamBlanks(@Param("studentId")Integer studentId, @Param("paperId")Integer paperId);


    List<ExamSubjectVO> selectExamTf(@Param("studentId")Integer studentId,@Param("paperId")Integer paperId);

    List<ExamSubjectVO> selectExamBig(@Param("studentId")Integer studentId,@Param("paperId")Integer paperId);

    List<PaperVO> queryPaper(Integer userId);

}